from pymilvus import FieldSchema,CollectionSchema,DataType,Collection

#定义字段
fields = [
    FieldSchema(name="id", dtype=DataType.INT64, description="id", is_primary=True),
    FieldSchema(name="vector", dtype=DataType.FLOAT_VECTOR, description="embedding向量", dim=768), #768维向量
    FieldSchema(name="category", dtype=DataType.VARCHAR, description="url", max_length=1000) #标量
]

#创建集合
schema = CollectionSchema(fields, "商品向量库")
collections = Collection(name="products", schema=schema)